Skip to main content

What is docker compose

Docker compose allows you to define and manage multiple docker containers. With docker compose, you can use a YAML file that has all the configurations.

Here are some things you can configure:

  1. Services (the containers that make your app, EG: the frontend)

  2. Networks (ports)

  3. Volumes (persistent storage)

It is very useful, assume we have an application that uses moderate/large stacks, such as this one.

  1. Next.JS Frontend

  2. Spring BOOT Backend

  3. MySQL DB

When you want to start it, the order matters a lot, EG: you can't start the backend without the DB else the backend will throw a "DB NOT FOUND" error. Hence docker compose will start these in your specified order.

It's very simple as you can start, pause and stop all these containers with just single commands, of course you can override it just to debug one, but overall it simplifies managing multiple containers.